import Cookies from 'js-cookie'

const userInfoKey = 'vue_admin_template_user_info'

export function getUserInfo() {
  let userInfo = Cookies.get(userInfoKey);
  return userInfo ? JSON.parse(userInfo) : {};
}

export function updateUserInfo(userInfo) {
  return Cookies.set(userInfoKey, JSON.stringify(userInfo))
}

export function removeUserInfo() {
  return Cookies.remove(userInfoKey)
}


const appInfoKey = 'vue_admin_template_app_info'

export function getAppInfo() {
  let appInfo = Cookies.get(appInfoKey);
  return appInfo ? JSON.parse(appInfo) : {};
}

export function updateAppInfo(appInfo) {
  return Cookies.set(appInfoKey, JSON.stringify(appInfo))
}

export function removeAppInfo() {
  return Cookies.remove(appInfoKey)
}
